﻿Imports Telerik.Web.UI
Imports System.Data.SqlClient
Imports System.Data

Partial Class PaymentVoucherHdr
    Inherits System.Web.UI.Page

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Me.Theme = GetGlobalResourceObject("SystemResource", "Theme")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim _lblPageTitle As Label
            _lblPageTitle = Me.Master.FindControl("lblPageTitle")
            _lblPageTitle.Text = GetLocalResourceObject("PageTitle")
        End If
    End Sub

    Protected Sub rgPaymentVoucherHdr_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgPaymentVoucherHdr.ItemCommand
        If e.CommandName = "Add" Then
            e.Canceled = True
            Session("PaymentVoucherID") = "0"
            Response.Redirect("~/Payment/PaymentVoucherDtl.aspx?PVID=")
        ElseIf e.CommandName = "Edit" Then
            For Each item In rgPaymentVoucherHdr.MasterTableView.Items
                Dim dataitem As GridDataItem = CType(item, GridDataItem)
                If dataitem.Selected = True Then
                    e.Canceled = True
                    Response.Redirect("~/Payment/PaymentVoucherDtl.aspx?PVID=" & dataitem("PaymentVoucherID").Text)
                    Exit Sub
                End If
            Next
        End If
    End Sub
End Class
